/*
ID: icerupt1
PROG: buylow
LANG: C++11
*/

/* solution
 *
 *
*/

#include <fstream>
#include <iostream>
#include <algorithm>
#include <unordered_set>

std::ifstream fin {"buylow.in" };
std::ofstream fout{"buylow.out"};

int const inf = 1<<25;
int const maxn = 5002;
int f[maxn];
int count[maxn];
int da[maxn];
int n;

int main()
{
	fin >> n;
	for (int i = 1; i <= n; i++) fin >> da[i];

	da[0] = inf; da[++n] = -1; f[0] = 1;
	int max_len = 0;
	for (int i = 1; i <= n; i++) {
		f[i] = 1;
		for (int j = i-1; j >= 0; j--)
			if (da[i] < da[j]) f[i] = std::max(f[i], f[j]+1);
		max_len = std::max(max_len, f[i]);
	}

	count[0] = 1;
	for (int i = 1; i <= n; i++) {
		std::unordered_set<int> duplicate;
		for (int j = i-1; j >= 0; j--)
			if (da[i] < da[j] && f[i] == f[j] + 1)
				if (duplicate.find(da[j]) == duplicate.end()) {
					count[i] += count[j];
					duplicate.insert(da[j]);
				}
	}

	std::cout << max_len - 2 << ' ' << count[n] << '\n';
	fout << max_len - 2 << ' ' << count[n] << '\n';
}

